package com.shop.service.impl;

import com.shop.bean.Goods;
import com.shop.bean.Page;
import com.shop.dao.GoodsDao;
import com.shop.dao.impl.GoodsDaoImpl;
import com.shop.service.GoodsService;

import java.util.List;

/**
 * @Author:zyn
 * @Date:2025/9/19--13:48:05
 */
public class GoodsServiceImpl implements GoodsService {
    private GoodsDao gd=new GoodsDaoImpl();
    @Override
    public Page<Goods> getAllGoods(int pageNum, int pageSize) {
        List<Goods> goodsList=gd.selectGoods(pageNum,pageSize);
        int rows=gd.selectGoodsNum();
        Page<Goods> goodsPage=new Page<>(goodsList,pageNum,pageSize,rows);
        return goodsPage;
    }

    @Override
    public int delelteGoodsById(int goodsId) {
        return gd.deleteGoodsById(goodsId);
    }
}
